package com.myc.subject.application.controller;


import com.alibaba.fastjson.JSON;
import com.myc.subject.common.entity.PageResult;
import com.myc.subject.infra.basic.entity.SubjectInfoEs;
import com.myc.subject.infra.basic.service.SubjectEsService;
import com.myc.subject.infra.entity.UserInfo;
import com.myc.subject.infra.rpc.UserRPC;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 * 标签Controller
 * */
@RestController
@RequestMapping("/subject/label")
@Slf4j
public class TestFeignController {

    @Resource
    private UserRPC userRPC;

    @Resource
    private SubjectEsService subjectEsService;

    @RequestMapping("testFeign")
    public void testFeign(){
        UserInfo myc = userRPC.getUserInfo("myc");
        log.info("TestFeignController.testFeign:{}",myc);
    }

    @PostMapping("querySubjectByKeyWord")
    public void querySubjectByKeyWord(){
        SubjectInfoEs subjectInfoEs = new SubjectInfoEs();
        subjectInfoEs.setKeyWord("Redis");
        PageResult<SubjectInfoEs> pageResult = subjectEsService.querySubjectList(subjectInfoEs);
        log.info("结果：querySubjectByKeyWord：{}", JSON.toJSONString(pageResult));
    }

}
